@echo off

if "%1" == "" goto syntax_error
if "%2" == "" goto syntax_error
if "%3" == "" goto syntax_error
if "%4" == "" goto syntax_error

set TOOL_DBSERVER=%1
set TOOL_DBNAME=%2
set TOOL_DBACCOUNT=%3
set TOOL_DBPASSWORD=%4
set TOOL_DBTABLESDIR=Tables

@echo Create tables....

@echo Address
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Address.Table.sql
if errorlevel 1 goto sql_error

@echo InformationTextType
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.InformationTextType.Table.sql
if errorlevel 1 goto sql_error

@echo SpecialNeed
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.SpecialNeed.Table.sql
if errorlevel 1 goto sql_error

@echo ParVisProperties
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.ParVisProperties.Table.sql
if errorlevel 1 goto sql_error

@echo Language
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Language.Table.sql
if errorlevel 1 goto sql_error

@echo ReportTextFieldDefinition
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.ReportTextFieldDefinition.Table.sql
if errorlevel 1 goto sql_error

@echo UserRole
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.UserRole.Table.sql
if errorlevel 1 goto sql_error

@echo FeeSet
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.FeeSet.Table.sql
if errorlevel 1 goto sql_error

@echo TicketStatus
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.TicketStatus.Table.sql
if errorlevel 1 goto sql_error

@echo EmailTemplate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.EmailTemplate.Table.sql
if errorlevel 1 goto sql_error

@echo Person
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Person.Table.sql
if errorlevel 1 goto sql_error

@echo InformationText
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.InformationText.Table.sql
if errorlevel 1 goto sql_error

@echo Couple
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Couple.Table.sql
if errorlevel 1 goto sql_error

@echo Minister
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Minister.Table.sql
if errorlevel 1 goto sql_error

@echo MinisterLanguage
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.MinisterLanguage.Table.sql
if errorlevel 1 goto sql_error

@echo CertificateLanguage
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.CertificateLanguage.Table.sql
if errorlevel 1 goto sql_error

@echo CeremonyLanguage
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.CeremonyLanguage.Table.sql
if errorlevel 1 goto sql_error

@echo Ceremony
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Ceremony.Table.sql
if errorlevel 1 goto sql_error

@echo CeremonySpecialNeed
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.CeremonySpecialNeed.Table.sql
if errorlevel 1 goto sql_error

@echo ReportMarriageCertificate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.ReportMarriageCertificate.Table.sql
if errorlevel 1 goto sql_error

@echo User
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.User.Table.sql
if errorlevel 1 goto sql_error

@echo ParvisUser
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.ParvisUser.Table.sql
if errorlevel 1 goto sql_error

@echo Ticket
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Ticket.Table.sql
if errorlevel 1 goto sql_error

@echo PreferredDate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.PreferredDate.Table.sql
if errorlevel 1 goto sql_error

@echo Booking
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Booking.Table.sql
if errorlevel 1 goto sql_error

@echo IndividualBooking
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.IndividualBooking.Table.sql
if errorlevel 1 goto sql_error

@echo TimeBlock
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.TimeBlock.Table.sql
if errorlevel 1 goto sql_error

@echo OrdinaryBooking
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.OrdinaryBooking.Table.sql
if errorlevel 1 goto sql_error

@echo TicketInformation
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.TicketInformation.Table.sql
if errorlevel 1 goto sql_error

@echo History
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.History.Table.sql
if errorlevel 1 goto sql_error

@echo Version
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBTABLESDIR%\dbo.Version.Table.sql
if errorlevel 1 goto sql_error

@echo Parvis Version
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% ParvisVersion.sql
if errorlevel 1 goto sql_error

@echo Performance Indexes
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% ParvisIndexes.sql
if errorlevel 1 goto sql_error

@echo *************************************************************
@echo *
@echo * All tables created successfully.
@echo *
@echo *************************************************************
goto end


:syntax_error
@echo *************************************************************
@echo *
@echo * Syntax error!
@echo * Required parameter is missing.
@echo *
@echo * Usage: CreateTables 'DatabaseServerName' DatabaseName' 'Account' 'Password'
@echo *
@echo *************************************************************
goto end


:sql_error
:end
